#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<set>
#include<map>
using namespace std;
int gcd(int m,int n);
int main()
{
	int m,n;
	while(cin>>m>>n)
	{
		if(m<n)
			swap(m,n);
		cout<<gcd(m,n)<<endl;	
	}
    return 0;
}
int gcd(int m,int n)
{
	if(n==0)
		return m;
	return gcd(n,m%n);
}
